﻿// Mask.cs created with MonoDevelop
// User: jmalcolm at 9:14 P 03/12/2008
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
//

using System;

namespace ReleaseIt
{
	
	
	public class Mask
	{
		string text;
		bool isSelected;

		public Mask(string mask)
		{
			// Default mask state is isSelected=true
			BuildMask(mask, true);
		}

		public Mask(string mask, bool active)
		{
			BuildMask(mask, active);
		}

		private void BuildMask(string mask, bool active)
		{
			text = mask;
			isSelected = active;
		}

		public string Text
		{
			get
			{
				return text;
			}
			set
			{
				text = value;
			}
		}

		public bool IsSelected
		{
			get
			{
				return isSelected;
			}
			set
			{
				isSelected = value;
			}
		}

		public override string ToString()
		{
			return text;
		}

		// Fancy stuff
		// Basically, if something is expecting a mask
		// but instead gets fed a string, the following
		// converts the string to a mask automatically
		public static implicit operator Mask(string value)
		{
			return new Mask(value);
		}
	}
}
